import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main_0 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String s = br.readLine();

        String strArr[] = s.split(" ");

        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < strArr.length; i++) {
            if (strArr[i].equals(",") || strArr[i].equals(".") || strArr[i].equals("?")) {
                sb.append(strArr[i] + " ");
            } else {
                String ss[] = strArr[i].split("");
                for (int j = ss.length - 1; j >= 0; j--) {
                    if ((ss[j].equals(",") || ss[j].equals(".") || ss[j].equals("?"))) {
                        continue;
                    } else {
                        sb.append(ss[j]);
                    }
                }
                if (strArr[i].contains(",") || strArr[i].contains(".") || strArr[i].contains("?")) {
                    sb.append(ss[ss.length - 1]);
                }
                sb.append(" ");

            }
        }
        System.out.println(sb.toString().trim());
    }
}
